  //框架类，框架私有类
window.fw = {
    Page: { "PgId": "sys" }, 
    "Ver": 3.71,
    sysConfig: {
       "PageId": {}, 
       "Ajax": {}
    }
    //...
};

//页面滑动//
(function (w, fw) {
    fw.Map = {
        ClearClass: function (target) {
            var list = ["pageNew", "pageOld", "pageInt", "slideSlow", "slideFast", "slideFastBack", "slideSlowBack"];
            for (var i = 0; i < list.length; i++) {
                target.removeClass(list[i]);
            }
            return target;
        },
        Create: function (PgId, target) {
            //起始页创建切换page
            if (fw.Page.PgId == "sys") fw.Page = target;
            //设置当前页PgId
            target.PgId = PgId;
            //创建正文
            var body = target.PagePaint();
                //.attr("id", PgId).appendTo($("#body"));
            //创建头部
            //fw.Head.Create(target);
            //创建滚动条
            //target.Scroll = new fw.Scroll(target);
            //是否第一个页面
            if (body.css("display") != "none") {
                fw.Page.PgId = PgId;
                //埋点
                //fw.Buried.PageId(PgId);
            }
            //创建Footer
            if (target.FooterType != null) this.Footer(target);
            //绑定事件
            if (target.EvtSet) target.EvtSet.call(target);
            if (target.InputDel) fw.InputDel(target);
            target.data = fw.Page.data;
            if (this.MapList == null) this.MapList = {};
            this.MapList[PgId] = target;
        },
        //底的行为
        //FooterType：0是共同 1创建 
        Footer: function (target) {
            if (target.FooterType == 1)
                target.PagePaintFooter().attr("id", "footer_" + target.PgId).appendTo($("#footer"));
        }
        //...
  }
})(window, fw);

//滑动动画控制
(function (w, fw) {
    var Slide = function () { };
    Slide.prototype = {
        PageShow: function (params, callback) {
            this.params = params;
            this.callback = callback;
            this.options = {};
            this.Init();
        },
        Init: function () {
            var c = this;
            c._Init();
              //if($.os.android) this.tar.parent().append("<span class='androidSpan'></span>");
            this.tar.live("touchstart", function (e) {
                c.stop();
                c._start();
                c.options.x1 = e.touches[0].pageX;
                e.preventDefault();
            });
            this.tar.live("touchmove", function (e) {
                e.preventDefault();
                  //if($.os.android) $("#" + fw.Page.PgId).find(".androidSpan").html(".");
                  c.options.x2 = e.touches[0].pageX;
                var tar3D = c.options.tar3D + (c.options.x2 - c.options.x1) / c.tar.width() * 100;
                c.tar.css({ "-webkit-transform": c.isUse3D(c.params, tar3D), "-webkit-transition": "0ms" });
            });
            this.tar.live("touchend", function () {
                  //if($.os.android) $("#" + fw.Page.PgId).find(".androidSpan").html("");
                var d = c.options.x1 - c.options.x2 > 0 ? 'Left' : 'Right';
                var isToNext = Math.abs(c.options.x1 - c.options.x2) > c.tar.width() / 5 ? true : false;
                if (isToNext) {
                    c._end(d);
                } else {
                    c._reback();
                }
            });
            if (c.params.isCircle) {
                this.tar.live("webkitTransitionEnd", function () {
                      if($.os.android) $("#" + fw.Page.PgId).find(".androidSpan").html("");
                    var end3D;
                    var index = parseInt(c.tip);
                    if (index == 0) {
                        end3D = 100 * (2 - c.tarChildLen);
                        c.tip = -end3D / 100;
                        c.tar.css({ "-webkit-transform": c.isUse3D(c.params, end3D), "-webkit-transition": "0ms" });
                    } else if (index == c.tarChildLen - 1) {
                        end3D = -100;
                        c.tip = -end3D / 100;
                        c.tar.css({ "-webkit-transform": c.isUse3D(c.params, end3D), "-webkit-transition": "0ms" });
                    }
                    if (c.params.isCircle) c.start();
                });
            }
        },
        _Init: function () {
            this.tar = this.params.slideWrap;
            this.tarChildLen = this.tar.children().length;
            this.tip = this.params.isCircle ? 1 : 0;
            this.tar.css({ "-webkit-transform": this.isUse3D(this.params, -this.tip * 100), "-webkit-transition": "0ms" });
        },
        isUse3D: function (params, val) {
            return (params && params.notUse3D) ? ("translateX(" + val + "%)") : ("translate3d(" + val + "%, 0px, 0px)");
        },
        _start: function () {
            this.options.index = this.tip;
            this.options.tar3D = -this.options.index * 100 || 0;
        },
        _reback: function () {
            this.tar.css({ "-webkit-transform": this.isUse3D(this.params, this.options.tar3D), "-webkit-transition": "100ms" });
        },
        _end: function (d) {
            var slsWrap3D;
            if (d == "Left") {
                if (this.options.index == this.tarChildLen - 1) return this._reback();
                if (this.callback) this.callback.call(this.tar, (parseInt(this.tip) + 1));
                slsWrap3D = this.options.tar3D - 100;
            } else {
                if (this.options.index == 0) return this._reback();
                if (this.callback) this.callback.call(this.tar, (parseInt(this.tip) - 1));
                slsWrap3D = this.options.tar3D + 100;
            }
            this.tip = -slsWrap3D / 100;
            this.tar.css({ "-webkit-transform": this.isUse3D(this.params, slsWrap3D), "-webkit-transition": "150ms" });
        },
        start: function () {
            var c = this;
            if (this.params.isCircle == false) this.params.isCircle = true;
            this.time = setTimeout(function () {
                c._start();
                c._end("Left");
            }, 3000);
        },
        stop: function () {
            clearTimeout(this.time);
            if (this.params.isCircle) this.params.isCircle = false;
        },
        startFirst: function () {
            this._Init();
        }
    };
    
    var SwipeTool = function () { };
    SwipeTool.prototype = {
        PageShow: function (params, callback) {
            this.params = params;
            this.callback = callback;
            this.Init();
        },
        Init: function () {
            var tar = this.params.slideWrap;
            var slideChidren = tar.children();
            var slideChidrenLen = slideChidren.length;
            if (slideChidrenLen == 1) return;
            this.StartCurList();
            if (this.params.isCircle) {
                tar.append($(slideChidren[0]).clone()).prepend($(slideChidren[slideChidrenLen - 1]).clone());
                slideChidren = tar.children();
                slideChidrenLen += 2;
            }
            for (var i = 0; i < slideChidrenLen; i++) {
                  $(slideChidren[i]).css("-webkit-transform", this.isUse3D(this.params, i * 100));
            }
            this.StartSwipe(slideChidrenLen);
        },
          isUse3D: function (params, val) {
                return (params && params.notUse3D) ? ("translateX(" + val + "%)") : ("translate3d(" + val + "%, 0px, 0px)");
          },
        StartCurList: function () {
            if (this.params.curList) {
                var cid = 0;
                if (this.params.isCircle) cid = 1;
                $(this.params.curList.children()[cid]).addClass("cur").siblings().removeClass("cur");
            }
        },
        StartSwipe: function (slideChidrenLen) {
            var c = this;
            this.slide = new Slide();
              this.slide.PageShow({ "isCircle": c.params.isCircle, "slideWrap": c.params.slideWrap, "notUse3D": c.params.notUse3D, "andObj": c.params.andObj }, c.callback || c.params.curList ? function (cid) {
                if (c.callback) c.callback.call(c.tar, cid);
                if (c.params.curList) {
                    if (c.params.isCircle) cid = (cid - 1 + (slideChidrenLen - 2)) % (slideChidrenLen - 2);
                    $(c.params.curList.children()[cid]).addClass("cur").siblings().removeClass("cur");
                }
            } : null);
        },
        Start: function () {
            this.slide.start();
        },
        Stop: function () {
            this.slide.stop();
        },
        StartFirst: function () {
            this.slide.startFirst();
            this.StartCurList();
        }
    };
    fw.SwipeTool = SwipeTool;
})(window, fw);

//引导页
(function (w) {
    var Boot = function () {
        this.art = {};
        this.imgArry = [];
        this.imgLength = 0;
    };
    Boot.prototype = {
        Init: function (ary,current) {
            this.art = {};
            this.imgArry = [];
            this.imgLength = 0;
            this.ary = ary;
            this.current = current;
            fw.Map.Create("pg_Boot", this);
            this.art.append("<div style='position:absolute;top: 10px;right: 20px;padding: 5px 10px;border-radius: 5px;color: #fff;background:#333;font-size: 14px;' id = 'img_return'>返回</div>");
        },
        PagePaint: function () {
            var html = ["<div id='div_Boot' style='-webkit-transform: translate3d(0%, 0px, 0px); -webkit-transition: 0ms; transition: 0ms;'>"],cid = 1;
            this.ary.forEach(function(item){
                var reg = new RegExp('"',"g");
                str = item.replace(reg, "");
                html.push("<div cid='"+cid+"' class='slider' style='-webkit-transform: translate3d(0%, 0px, 0px);'><img src = "+str.replace('?imageView2/1/w/200/h/200/q/75/format/jpg',"").concat("?imageView2/2/w/800/q/75/format/jpg").toString()+"></div>");
                cid++;
            });
            html.push("</div>");
            $(".m-slides").html(html.join(""));
            //if (!$.isEmptyObject(fw.Map.MapList)) art.css("display", "none");<ul id='div_cur' class='nav'><li class='cur'></li><li></li></ul>
            this.art = $("#img_article");
            return this.art;
        },
        PageShow: function () {
            if (this.swipe) this.swipe.StartFirst();
            fw.Map.Next(this);
        },
        EvtSet: function () {
            c = this;
            this.swipe = new fw.SwipeTool();
            this.swipe.PageShow({ "slideWrap": $("#div_Boot") });

            $("#div_Boot img").on("load",function(){
                c.imgArry.push(this);
                c.imgLength++;
                if(c.imgLength == $("#div_Boot img").length){
                    $("#div_Boot img").trigger("trigger");
                }
            });
            $("#div_Boot img").on("trigger",function(){
                //$("#div_Boot").css("transform","translate3d(-"+c.current*100+"%, 0px, 0px);");
                setTimeout(function(){
                    c.imgArry.forEach(function(item){
                        item.style.marginTop = -(item.height/2)+"px";
                    });
                },100);
                c.imgLength = 0;
            });
            $(document).on("touchend","#img_return",function(){

                //$(".m-slides").html("");
                $("#img_article").css("display","none");
                e.preventDefault();
            });
        }
    };
    w.Boot = Boot;
})(window);
  //启动项
  var imgBoot = new Boot();